<template>
    <section class="content-box">
       	<div>
            <div class="index-content">
                <p class="index-des">快捷入口</p>
                <div class="index-entry" >
    				<a href="#" @click="Accounting()" class="index-entry-items1">
						<img src="static/content/images/LedgerView/pic-1.png" alt="">
						<p>记账</p>
					</a>
    				<!--<a href="#" @click="Make()" class="index-entry-items2"><p>制造费用结转</p></a>-->
    				<a href="#" @click="Profit()" class="index-entry-items3">
						<img src="static/content/images/LedgerView/pic-1.png" alt="">						
						<p>损益结转</p>
					</a>
    				<a href="#" @click="knotMonthly()" class="index-entry-items4">
						<img src="static/content/images/LedgerView/pic-1.png" alt="">	
						<p>月结</p>
					</a>
    				<a href="#" @click="Monthly()" class="index-entry-items5">
						<img src="static/content/images/LedgerView/pic-1.png" alt="">	
						<p>反月结</p>
					</a>
    			</div>
           </div>
        <!-- 损益判断-->
        <el-dialog title="损益结转" :modal-append-to-body="false" :visible.sync="dialogFormVisibleS" size="tiny">
		  <div>
		  	<p>提示：该功能将损益类科目余额转入本月“本年利润”科目，
		  		
		  		并生成相应的记账凭证，

				 在结转本期损益以前，
				
				 请将本期凭证全部记账！
							
				（当前的会计期间：{{DataS}}月） 
				
				（结转损益将本期收入，
				
				支出类科目结转到本年利润科目中，
				
				   结转后损益类科目无余额。）</p>
		  	
		  </div>
		  
		  <div slot="footer" class="dialog-footer">
		    <el-button @click="dialogFormVisibleS = false">取 消</el-button>
		    <el-button type="primary" @click="ProfitQueding">确 定</el-button>
		  </div>
		</el-dialog>
		<!-- 损益判断-->
		<!-- 制造费用结转判断-->
        <!--<el-dialog title="制造费用结转" :visible.sync="dialogFormVisibleZ" size="tiny">
		  <div>
		  	<p>提示：结账后不能再输入本期新的凭证，

				 所以在结账之前先将所有凭证审核，
				
				 记账，并结转损益！请在期末结转时不
				
				 要做其他的操作。
				
				
				（当前的合计期间：{{DataZ}}月） 
				
				（月末结账之前请进行结转损益，固定
				
				   资产折旧，工资的相关处理。）</p>
		  	
		  </div>
		  
		  <div slot="footer" class="dialog-footer">
		    <el-button @click="dialogFormVisibleZ = false">取 消</el-button>
		    <el-button type="primary" @click="MakeQueding()">确 定</el-button>
		  </div>
		</el-dialog>-->
		<!-- 制造费用结转判断-->
       	<!-- 月结判断-->
        <el-dialog title="月结" :modal-append-to-body="false" :visible.sync="dialogFormVisibleY" size="tiny">
		  <div>
		  	<p>提示：结账后不能再输入本期新的凭证，
				  
				 所以在结账之前先将所有凭证审核，
				
				 记账，并结转损益！请在期末结转时不
				
				 要做其他的操作。
				
				
				（当前的会计期间：{{DataY}}月） 
				
				（月末结账之前请进行结转损益，固定
				
				   资产折旧，工资的相关处理。）</p>
		  	
		  </div>
		  
		  <div slot="footer" class="dialog-footer">
		    <el-button @click="dialogFormVisibleY = false">取 消</el-button>
		    <el-button type="primary" @click="knotMonthlyQueding()">确 定</el-button>
		  </div>
		</el-dialog>
		<!-- 月结判断-->
		</div>
    </section>	
</template>
<script>
import Vue from 'vue'
import axios from '../../../util/axios'

export default {
    components:{
        
    },
    data() {
        return {
            dialogFormVisibleY:false,
            dialogFormVisibleS:false,
            dialogFormVisibleZ:false,
            DataY:'',
            DataS:'',
            DataZ:'',
            Period:''
        }
    },
    created(){
        this.Fu_GetPeriodList()
        
    },
    methods:{
    	Accounting(){//记账
    		this.$router.push('/Accounting');
    	},
    	Fu_GetPeriodList(){
				axios
				.post('Fu_GetPeriodList')
				.then(res => {
					console.log(res);
					for(let i = 0 ; i < res.length ; i++){
						if(res[i].IsCurrent ==1){
							this.Period = res[i].Code
						}
					}
					this.formatDate()
				})
				.catch(err => {
					console.log(err);
				})
				
			},
			formatDate() {
	    		console.log(this.Period)
	    		var date = new Date(this.Period);
				var Y = date.getFullYear();
				var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1);
				var D = date.getDate();
				console.log(M); //呀麻碟
		      	this.DataY = M
		      	this.DataS = M
		      	this.DataZ = M
		    },
//  	Make(){//判断制造
//  		axios
//  		.post("InspectZhiZao")
//	    		.then(res => {
//		          console.log(res)
//		          if(res.Success){
//		          	console.log("正确")
//		          	this.DataZ = res.Data
//		          	console.log(this.Data)
//		          	this.dialogFormVisibleZ = true
//		          }else{
//		          	this.$message({
//		                message: res.Message,
//		                type: 'error',
//		                duration:2000
//	              	})
//		          }
//		        });
//  	},
//  	MakeQueding(){//制造结转
//  		axios
//  		.post("ZhiZao")
//	    		.then(res => {
//		          console.log(res)
//		          if(res.Success){
//		          	this.dialogFormVisibleZ = false
//		          	this.$message({
//		                message: res.Message,
//		                type: 'success',
//		                duration:2000
//	              	})
//		          }else{
//		          	this.dialogFormVisibleZ = false
//		          	this.$message({
//		                message: res.Message,
//		                type: 'error',
//		                duration:2000
//	              	})
//		          }
//		        })
//  	},
    	Profit(){//判断损益
		          	this.dialogFormVisibleS = true
    	},
    	ProfitQueding(){//损益结转确定
    		axios
    		.post("SunYi")
	    		.then(res => {
		          console.log(res)
		          if(res.Success){
		          	this.dialogFormVisibleS = false
		          	this.$message({
		                message: res.Message,
		                type: 'success',
		                duration:2000
	              	})
		          }else{
		          	this.dialogFormVisibleS = false
		          	this.$message({
		                message: res.Message,
		                type: 'error',
		                duration:2000
	              	})
		          }
		        })
    	},
    	knotMonthly(){//判断月结
 
		          	this.dialogFormVisibleY = true

    	},
    	knotMonthlyQueding(){//月结确定
    		axios.post("MonthEnd")
	    		.then(res => {
		          console.log(res)
		          if(res.Success){
		          	this.dialogFormVisibleY = false
		          	this.$message({
		                message: res.Message,
		                type: 'success',
		                duration:2000
	              	})
		          }else{
		          	this.dialogFormVisibleY = false
		          	this.$message({
		                message: res.Message,
		                type: 'error',
		                duration:2000
	              	})
		          }
		        })		
    	},
    	Monthly(){//反月结
    		axios
    		.post("UndoMonthEnd")
	    		.then(res => {
		          console.log(res)
		          if(res.Success){
		          	this.$message({
		                message: res.Message,
		                type: 'success',
		                duration:2000
	              	})
		          }else{
		          	this.$message({
		                message: res.Message,
		                type: 'error',
		                duration:2000
	              	})
		          }
		        })
    	},
    }
}

</script>
<style scoped lang="scss">
@import '../../../common/css/index.css';
.v-modal{
	display: none;
}
.index-content{
    margin: 0 40px;
    .index-des{
        width: 1100px;
        margin: 30px auto 20px auto;
        font-size: 16px;
        font-weight: bold;
    }
    .index-entry{
        width: 911px;
        height: 200px;
        line-height: 200px;
        background-color: #FFF;
        margin: 0 auto;
        box-shadow: 1px 1px 5px 1px #DDD;       
        /* .index-entry-items1{
            background:url(../../../assets/img/LedgerView/pic-1.png) no-repeat;
        }
        .index-entry-items2{
            background:url(../../../assets/img/LedgerView/pic-1.png) no-repeat;
        }
        .index-entry-items3{
            background:url(../../../assets/img/LedgerView/pic-1.png) no-repeat;
        }
        .index-entry-items4{
            background:url(../../../assets/img/LedgerView/pic-1.png) no-repeat;
        }
        .index-entry-items5{
            background:url(../../../assets/img/LedgerView/pic-1.png) no-repeat;
        } */
        a {
            display: inline-block;
            width: 102px;
            height: 120px;
            text-align: justify;
            text-align: center;
            color: #666;
            margin: 45px 0 0 95.3333px;
            text-decoration: none;
			img{
				display: block;
			}
			p {
				height: 30px;
				line-height: 30px;
			}
        }
        
    }
}
</style>